<template>
	<view>
		<view class="list magrin_top" @click="handleClick('personal')">
			<text>个人资料</text>
			<image src="https://hosue-omo.oss-cn-shenzhen.aliyuncs.com/assets/rightIcon.png" mode=""></image>
		</view>
		<!-- <view class="line" />
		<view class="list">
			<text>实名认证</text>
			<image src="https://hosue-omo.oss-cn-shenzhen.aliyuncs.com/assets/rightIcon.png" mode=""></image>
		</view>
		<view class="list magrin_top" @click="handleClick('bank')">
			<text>绑定银行卡</text>
			<image src="https://hosue-omo.oss-cn-shenzhen.aliyuncs.com/assets/rightIcon.png" mode=""></image>
		</view> -->
		<view class="list magrin_top " @click="handleWebView('userProtocol')">
			<text>用户协议</text>
			<image src="https://hosue-omo.oss-cn-shenzhen.aliyuncs.com/assets/rightIcon.png" mode=""></image>
		</view>
		<view class="line" />
		<view class="list" @click="handleWebView('privacyPolicy')">
			<text>隐私政策</text>
			<image src="https://hosue-omo.oss-cn-shenzhen.aliyuncs.com/assets/rightIcon.png" mode=""></image>
		</view>
		<!-- <view class="line" /> -->
		<view class="list magrin_top"  @click="handleLoginOut">
			<text>退出登录</text>
			<image src="https://hosue-omo.oss-cn-shenzhen.aliyuncs.com/assets/rightIcon.png" mode=""></image>
		</view>
	</view>
</template>

<script setup>
	import http from '../../uitls/http.js'
import {logout} from './js/api.js'
	const handleClick = (source) => {
		const urlObj ={
			personal: "/pagesA/personalData/personalData",
			bank:"/pagesA/bankCard/bankCard"
		}
		if(urlObj[source]){
			uni.navigateTo({
				url: urlObj[source]
			})
		}
		
	}
	const handleWebView =(type)=>{
		uni.navigateTo({
			url:'/pagesA/webView/webView?type='+type
		})
	}
	const app = getApp()
	const loginOut = async()=>{
		let res = await logout()
		if(res.data.code == 0){
			http.isMssage(res.data.data)
			uni.removeStorageSync('token')
			app.setIsLogins('loginOut')
			app.setUserType(1)
			uni.navigateTo({
				url:'/pagesA/login/login'
			})
		}
	}
	
	
	const handleLoginOut = ()=>{
		uni.showModal({
			title: '提示',
			content: '确定退出登录吗～？',
			success: function(res) {
				if (res.confirm) {
					loginOut()
				} else if (res.cancel) {
					console.log('用户取消');
				}
			}
		});
		
		
	}
</script>

<style>
	page {
		background: #F6F6F6 !important;
	}
</style>
<style lang="less" scoped>
	.list {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 0 30rpx;
		background: #ffffff;
		height: 90rpx;

		text {
			font-family: PingFangSC-Regular;
			font-size: 28rpx;
			color: #333333;
			font-weight: 400;
		}

		image {
			height: 34rpx;
			width: 20rpx;
		}

	}

	.line {
		background: #eeeeee;
		height: 1rpx;
		// width: 100%;
		margin: 0 30rpx;
	}

	.magrin_top {
		margin-top: 16rpx;
	}
</style>